package constants

type StatusCode int

func (code StatusCode) GetMsg() string {
	var msg string
	switch code {
	case CodeSuccess:
		msg = MsgSuccess
	case CodeError:
		msg = MsgError
	case CodeInvalidParams:
		msg = MsgInvalidParams
	case CodeJsonUnmarshalType:
		msg = MsgJsonError
	case CodeNoToken:
		msg = MsgNoToken
	case CodeAuthenticateError:
		msg = MsgAuthenticateError
	case CodeTokenTimeout:
		msg = MsgTokenTimeout
	case CodeUserExist:
		msg = MsgUserExist
	case CodeRegisterFail:
		msg = MsgRegisterFail
	case CodeLoginFail:
		msg = MsgLoginFail
	case CodeLogoutFail:
		msg = MsgLogoutFail
	case CodeShowTaskFail:
		msg = MsgShowTaskFail
	case CodeFindTaskFail:
		msg = MsgFindTaskFail
	case CreateTaskFail:
		msg = MsgCreateTaskFail
	case UpdateTaskFail:
		msg = MsgUpdateTaskFail
	}
	return msg
}

// 通用状态码
const (
	CodeSuccess       StatusCode = iota
	CodeInvalidParams StatusCode = iota + 1100
	CodeError
	CodeJsonUnmarshalType
)

// 鉴权相关的状态码
const (
	CodeNoToken StatusCode = iota + 1201
	CodeAuthenticateError
	CodeTokenTimeout
)

// 用户相关状态码
const (
	CodeUserExist StatusCode = iota + 1301
	CodeRegisterFail
	CodeLoginFail
	CodeLogoutFail
)

const (
	CodeShowTaskFail StatusCode = iota + 1401
	CodeFindTaskFail
	CreateTaskFail
	UpdateTaskFail
)
